<?php
/*================================================================
	MODULO PHP NUKE  - TSMEMBERS VER 2.1
	REALIZZATO DA Queen_live78
	WWW.TUTTOSOFT.IT - PHP NUKE ITALIAN COMMUNITY -
	DATA : 20 DICEMBRE 2008
	TUTTI I DIRITTI RISERVATI
================================================================*/
/**********************************************/
/* XHTML compliance, code clean up and
/* Further enhancements by: Jonathan Estrella
/* http://slaytanic.sourceforge.net
/**********************************************/
defined('MODULE_FILE') or die('You can\'t access this file directly.');

/* You might want to edit this few values */
$perpage = 20; // Number of users to show per page
$spusers = 20; // Number of users to show on special lists at bottom
$variant = 'Anonymous'; // Do not change this unless you real sure of what you're doing

require_once('mainfile.php');
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
include('header.php');
$totalusers = $db->sql_numrows($db->sql_query('SELECT user_id FROM '.$prefix.'_users WHERE username <> \''.$variant.'\''));
$page = (isset($_GET['page'])) ? intval($_GET['page']) : 1;
$ofsbgn = ($page*$perpage)-$perpage;

Opentable();
echo '<img style="width: 320px; height: 58px; border: 0px none; display: block; margin: auto;" src="modules/'.$module_name.'/images/logotsmembers.gif" alt="" /><br /><br />'.PHP_EOL;

// This is where we list all site users
$cerca=$db->sql_query('SELECT user_id, username, user_avatar, user_lang, user_posts, user_website, user_regdate, points FROM '.$prefix.'_users WHERE username <> \''.$variant.'\' ORDER BY user_id ASC LIMIT '.$ofsbgn.','.$perpage.'');
echo '<h2 style="text-align: center; margin: 0 0 2em 0;">'._TSM_ALLUSERS.' '.$sitename.'</h2>'.PHP_EOL;
$bgcolorts = $bgcolor4;
echo '<table align="center" cellspacing="1" cellpadding="3" width="100%">'.PHP_EOL;
while ($data = $db->sql_fetchrow($cerca)) {
	$nomeid=stripslashes($data['user_id']);
	$nome=stripslashes($data['username']);
	$avatar=stripslashes($data['user_avatar']);
	$lingua=stripslashes($data['user_lang']);
	$post=stripslashes($data['user_posts']);
	$web=stripslashes($data['user_website']);
	$datareg=stripslashes($data['user_regdate']);
	$points=intval($data['points']);
	$imgcss = 'width: 16px; border: 0px none; margin: 0em 0.3em 0em 0.3em; vertical-align: middle;';
	if(!empty($web) && $web!=='http://') {
		$weblink = '<a href="'.$web.'"><img style="'.$imgcss.'" src="modules/'.$module_name.'/images/internet-web-browser.png" alt="'._TSM_WEBSITE.': '.$web.'" title="'._TSM_WEBSITE.': '.$web.'" /></a>'.PHP_EOL;
	} else {
		$weblink = '<img style="'.$imgcss.'" src="modules/'.$module_name.'/images/internet-web-browser.png" alt="'._TSM_WEBSITE.': N/A" title="'._TSM_WEBSITE.': N/A" />'.PHP_EOL;
	}
	$bull= _TSM_USERREGON .' '.$datareg.' '. _TSM_ACTUALLYONFORUM .' '.$post.' '. _TSM_POSTS;
	echo '	<tr bgcolor="'.$bgcolorts.'">'.PHP_EOL;
	echo '		<td width="110">'.PHP_EOL;
	if(!empty($avatar) && !eregi('blank.gif', $avatar)) {
		if(eregi('http://', $avatar)) { $src = $avatar; } else  { $src = 'modules/Forums/images/avatars/'.$avatar; }
	} else {
		$src = 'modules/'.$module_name.'/images/no_avatar.png';
	}
	echo '			<center><a href="modules.php?name=Your_Account&amp;op=userinfo&amp;username='.$nome.'"><img style="width: 80px; border: 0px; margin: 1em;" src="'.$src.'" alt="'.$nome.'" title="'.$nome.'" /></a></center>'.PHP_EOL;
	echo '		</td>'.PHP_EOL;
	echo '		<td>'.PHP_EOL;
	echo '			<img style="'.$imgcss.'" src="modules/'.$module_name.'/images/contact-new.png" alt="*" />'.PHP_EOL;
	echo '			<span style="font-size: 110%; font-weight: bold;"><a href="modules.php?name=Your_Account&amp;op=userinfo&amp;username='.$nome.'">'.$nome.'</a></span>'.PHP_EOL;
	echo '			<a href="modules.php?name=Private_Messages&amp;mode=post&amp;u='.$nomeid.'"><img style="'.$imgcss.'" src="modules/'.$module_name.'/images/mail-message-new.png" alt="'._TSM_SENDPRIVMSG.'" title="'._TSM_SENDPRIVMSG.'" /></a>'.$weblink.'<br />'.PHP_EOL;
	echo '			<img style="'.$imgcss.'" src="modules/'.$module_name.'/images/appointment-new.png" alt="*" />'.PHP_EOL;
	echo '			'._TSM_REGISTEREDON.': '.$datareg.'<br />'.PHP_EOL;
	echo '			<img style="'.$imgcss.'" src="modules/'.$module_name.'/images/system-users.png" alt="*" />'.PHP_EOL;
	echo '			'._TSM_POSTS.': '.$post.'<br />'.PHP_EOL;
	echo '			<img style="'.$imgcss.'" src="modules/'.$module_name.'/images/preferences-desktop-locale.png" alt="*" />'.PHP_EOL;
	echo '			'._TSM_LANGUAGE.': '.$lingua.'<br />'.PHP_EOL;
	echo '			<img style="'.$imgcss.'" src="modules/'.$module_name.'/images/office-calendar.png" alt="*" />'.PHP_EOL;
	echo '			'._TSM_POINTS.': '.$points.'<br />'.PHP_EOL;
	echo '		</td>'.PHP_EOL;
	echo '	</tr>'.PHP_EOL;
}
echo '</table>'.PHP_EOL;

// Uhm... too many users, let's use some pages
/* New pagination class by Vecchio Joe   [ http://www.vecchiojoe.it ] */
include_once('modules/'.$module_name.'/includes/paginationSystem.class.php');
$ps = new paginationSystem();
$ps->items = $perpage;
$ps->actpg = $page;
$ps->override_query	= true;
$ps->tot_items = $totalusers;
$ps->url = 'modules.php?name='.$module_name.'&amp;page={{N}}';
$ps->show();

// Now let's list some very special users
echo '<br /><br />'.PHP_EOL;
echo '<table width="100%" border="0" cellspacing="1" cellpadding="3">'.PHP_EOL;
echo '  <tr>'.PHP_EOL;
echo '    <th width="33%" valign="top"><img style="width: 16px; border: 0px; margin: 0.5em; vertical-align: middle;" src="modules/'.$module_name.'/images/emblem-favorite.png" alt="*" />'._TSM_TOPUSERS.'</th>'.PHP_EOL;
echo '    <th width="33%" valign="top"><img style="width: 16px; border: 0px; margin: 0.5em; vertical-align: middle;" src="modules/'.$module_name.'/images/emblem-new.png" alt="*" />'._TSM_MOSTACTIVEUSERS.'</th>'.PHP_EOL;
echo '    <th width="33%" valign="top"><img style="width: 16px; border: 0px; margin: 0.5em; vertical-align: middle;" src="modules/'.$module_name.'/images/appointment-new.png" alt="*" />'._TSM_LASTUSERSREG.'</th>'.PHP_EOL;
echo '  </tr>'.PHP_EOL;
echo '  <tr style="background-color: '.$bgcolor4.'">'.PHP_EOL;
echo '		<td width="33%" valign="top">'.PHP_EOL;
$a = 1;
$result = $db->sql_query('SELECT username, points, user_avatar FROM '.$prefix.'_users WHERE username <> \''.$variant.'\' ORDER BY points DESC limit 0,'.$spusers.'');
while ($row = $db->sql_fetchrow($result)) {
	$username = stripslashes($row['username']);
	$points = intval($row['points']);
	$avatar = stripslashes($row['user_avatar']);
	if(!empty($avatar) && !eregi('blank.gif', $avatar)) {
       	if(eregi('http://', $avatar)) { $src = $avatar; } else  { $src = 'modules/Forums/images/avatars/'.$avatar; }
    } else {
    	$src = 'modules/'.$module_name.'/images/no_avatar.png';
	}
	echo $a.') <img style="width: 22px; border: 0px; padding: 0 0.5em 0.5em 0.5em; vertical-align: middle;" src="'.$src.'" alt="*" /><a href="modules.php?name=Your_Account&amp;op=userinfo&amp;username='.$username.'">'.$username.'</a>'.PHP_EOL;
	echo ' [<b>'.$points.'</b> '._TSM_POINTS.']<br />'.PHP_EOL;
	$a++;
}
echo '		</td>'.PHP_EOL;
echo '		<td width="33%" valign="top">'.PHP_EOL;
$a = 1;
$result = $db->sql_query('SELECT username, user_posts, user_avatar FROM '.$prefix.'_users WHERE username <> \''.$variant.'\' ORDER BY user_posts DESC limit 0,'.$spusers.'');
while ($row = $db->sql_fetchrow($result)) {
	$username = stripslashes($row['username']);
	$posts = intval($row['user_posts']);
	$avatar = stripslashes($row['user_avatar']);
	if(!empty($avatar) && !eregi('blank.gif', $avatar)) {
       	if(eregi('http://', $avatar)) { $src = $avatar; } else  { $src = 'modules/Forums/images/avatars/'.$avatar; }
    } else {
    	$src = 'modules/'.$module_name.'/images/no_avatar.png';
	}
	echo $a.') <img style="width: 22px; border: 0px; padding: 0 0.5em 0.5em 0.5em; vertical-align: middle;" src="'.$src.'" alt="*" /><a href="modules.php?name=Your_Account&amp;op=userinfo&amp;username='.$username.'">'.$username.'</a>'.PHP_EOL;
	echo ' [<b>'.$posts.'</b> '._TSM_POSTS.']<br />'.PHP_EOL;
	$a++;
}
echo '		</td>'.PHP_EOL;
echo '		<td width="33%" valign="top">'.PHP_EOL;
$a = 1;
$result = $db->sql_query('SELECT username, user_regdate, user_avatar FROM '.$prefix.'_users WHERE username <> \''.$variant.'\' ORDER BY user_id DESC limit 0,'.$spusers.'');
while ($row = $db->sql_fetchrow($result)) {
	$username = stripslashes($row['username']);
	$regdate = $row['user_regdate'];
	$avatar = stripslashes($row['user_avatar']);
	if(!empty($avatar) && !eregi('blank.gif', $avatar)) {
       	if(eregi('http://', $avatar)) { $src = $avatar; } else  { $src = 'modules/Forums/images/avatars/'.$avatar; }
    } else {
    	$src = 'modules/'.$module_name.'/images/no_avatar.png';
	}
	echo $a.') <img style="width: 22px; border: 0px; padding: 0 0.5em 0.5em 0.5em; vertical-align: middle;" src="'.$src.'" alt="*" /><a href="modules.php?name=Your_Account&amp;op=userinfo&amp;username='.$username.'">'.$username.'</a>'.PHP_EOL;
	echo ' ['.$regdate.']<br />'.PHP_EOL;
	$a++;
}
echo '		</td>'.PHP_EOL;
echo '	</tr>'.PHP_EOL;
echo '</table>'.PHP_EOL;
echo '<br /><br />'.PHP_EOL;
CloseTable();
include('footer.php');
?>